From: Florian Müllner Date: Sat, 2 Mar 2019 19:53:33 +0000 (+0100) Subject: messageTray: Add source policy setter X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~888^2^2~32 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=1c9d821aa2f3937bc95dd7f7370cbeaa614b2e25;p=gnome-shell.git messageTray: Add source policy setter Commit 8f15193b4 changed the `policy` property from a regular JS property to a getter. This was necessary to avoid calling an overridden _createPolicy() method before a subclass is properly initialized, but it broke the second way of using notification sources: Don't create a Source subclass, but use the base class directly and change its `policy` property. There's no good reason why we should no longer allow this, so add a setter. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/431 --- diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js index dcba4788f..8f8130451 100644 --- a/js/ui/messageTray.js +++ b/js/ui/messageTray.js @@ -708,6 +708,12 @@ var Source = class Source { return this._policy; } + set policy(policy) { + if (this._policy) + this._policy.destroy(); + this._policy = policy; + } + get count() { return this.notifications.length; }